//
//  WeatherModel.swift
//  GreenDeal
//
//  Created by Moennig Q on 2023/4/10.
//

import UIKit
import HandyJSON
class DayWeatherModel: HandyJSON {
    var latitude: String = ""
    var longitude: String = ""
    var date: String = ""//"2023-04-10"
    var maxtemp_f: String = ""
    var maxtemp_c: String = ""
    var mintemp_c: String = ""
    var mintemp_f: String = ""
    var avgtemp_c: String = ""
    var avgtemp_f: String = ""
    var condition_text: String = ""//"Sunny"
    var condition_icon: String = ""//cdn.weatherapi.com/weather/64x64/day/113.png"
    var condition_icon_seq: String  {
        var r = ""
        if let last = condition_icon.split(separator: "/").last, let data = last.split(separator: ".").first{
            r = data.description
        }
        return r
    }
    var condition_code: Int = 0
    var air_quality_co: String = ""
    var air_quality_no2: String = ""
    var air_quality_o3: String = ""
    var air_quality_so2: String = ""
    var air_quality_pm2_5: String = ""
    var air_quality_pm10: String = ""
    var hour: [HourWeacherModel] = [HourWeacherModel]()
    required init() {
    }
}
class HourWeacherModel: HandyJSON {
    var time: String = "" //"2023-04-10 00:00"
    var temp_c: String = ""
    var temp_f: String = ""
    var condition_text: String = ""
    var condition_icon: String = ""
    var condition_icon_seq: String  {
        var r = ""
        if let last = condition_icon.split(separator: "/").last, let data = last.split(separator: ".").first{
            r = data.description
        }
        return r
    }
    var condition_code: Int = 0
    var air_quality_co: String = ""
    var air_quality_no2: String = ""
    var air_quality_pm2_5: String = ""
    var air_quality_o3: String = ""
    var air_quality_so2: String = ""
    var air_quality_pm10: String = ""
    required init() {
    }
}
